{extend name='main'}

{block name="content"}

<div class="layui-card">
    <div class="layui-card-header">测试页面 - 检查设备管理功能</div>
    <div class="layui-card-body">
        
        {if isset($error)}
        <div class="layui-alert layui-alert-danger">
            <strong>错误:</strong> {$error}
        </div>
        {else}
        <div class="layui-alert layui-alert-success">
            <strong>成功:</strong> 设备模型工作正常，找到 {$deviceCount} 个设备
        </div>
        {/if}
        
        <h3>设备列表:</h3>
        {if !empty($devices)}
        <table class="layui-table">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>设备序列号</th>
                    <th>设备名称</th>
                    <th>门店ID</th>
                    <th>状态</th>
                    <th>在线状态</th>
                </tr>
            </thead>
            <tbody>
                {foreach $devices as $device}
                <tr>
                    <td>{$device.id}</td>
                    <td>{$device.sn}</td>
                    <td>{$device.name|default='未命名'}</td>
                    <td>{$device.store_id}</td>
                    <td>{$device.status}</td>
                    <td>{$device.online_status}</td>
                </tr>
                {/foreach}
            </tbody>
        </table>
        {else}
        <p>没有找到设备数据</p>
        {/if}
        
        <h3>测试链接:</h3>
        <p>
            <a href="{:url('checkin/device/index')}" class="layui-btn">访问设备列表</a>
            <a href="{:url('checkin/device/statistics')}" class="layui-btn layui-btn-warm">访问设备统计</a>
        </p>
        
    </div>
</div>

{/block}
